#include "CDevice.h"
#include <string.h>
#include <iostream>

using namespace std;

CDevice::CDevice(const char *DeviceName)
{
	if (DeviceName!=NULL)
		strcpy_s(sDeviceName,DeviceName);
	iDeviceID = 0;
}


CDevice::~CDevice(void)
{
}

int CDevice::getDeviceID() const
{
	return iDeviceID;	
}
const char *CDevice::getDeviceName() const
{
	return sDeviceName;
}
void CDevice::setDeviceID(const int i)
{
	if (i>0)
		iDeviceID = i;	
}
void CDevice::setDeviceName(const char *DName)
{
	int len = (int)strlen(DName);
	if (len >=1 && len<20)
		strcpy_s(sDeviceName,DName);
}
void CDevice::show()
{
	cout<<"Device Name: "<<getDeviceName()<<"."<<endl;
	cout<<"Device ID :"<<getDeviceID()<<"."<<endl;

}
